home *** CD-ROM | disk | FTP | other *** search
- Path: ub239.dialup.uwa.edu.au!localhost!prye
- From: prye@cyllene.uwa.edu.au (Peter Rye)
- Newsgroups: comp.lang.c
- Subject: Re: Help:what is wrong this code?
- Date: 10 Apr 1996 15:12:19 GMT
- Organization: The University of Western Australia
- Message-ID: <PRYE.96Apr10231219@cyllene.uwa.edu.au>
- References: <4k3p3q$n76@brahms.udel.edu> <4k4hi3$5hm@sparcserver.lrz-muenchen.de>
- <Pine.ULT.3.92.960409210416.383A-100000@henson.cc.wwu.edu>
- NNTP-Posting-Host: ub239.dialup.uwa.edu.au
- In-reply-to: Norma Mathews's message of Tue, 9 Apr 1996 21:05:47 -0700
- X-Mailer: GNU Emacs 19.28
-
- >>>>> "Norma" == Norma Mathews <n9341884@henson.cc.wwu.edu> writes:
-
- Norma> On 6 Apr 1996, Kurt Watzka wrote:
-
- >> yuehong@brahms.udel.edu (Yue-hong Zheng) writes:
- >>
- >>
- >> >Why it give me 0.0000?
- >>
- >> >#include <stdio.h> >main () { >double a=9.008;
- >> >printf("%f\n",sqrt(a)); >return 0; >}
-
-
-
-
- Norma> your printf specifer needs to be "%lf", not "%f", since a
- Norma> is a double
-
- But when I try this my compiler complains:
-
- ub239:~$ cat junk.c
- #include <math.h>
- #include <stdio.h>
-
- int main() {
- double x = 3.232;
- printf("%lf\n", sqrt(x));
- return 0;
- }
- ub239:~$ gcc -c -Wall -ansi -pedantic junk.c
- junk.c: In function `main':
- junk.c:6: warning: use of `l' length character with `f' type character
-
- Why ? ;-)
- --
- Peter Rye prye@cyllene.uwa.edu.au, prye@ichr.uwa.edu.au
- Respiratory Research Fellow, Princess Margaret Hospital for Children
- Perth, Western Australia Ph: +61 (09) 340 8985, Fax: +61 (09) 388 2097
- ** Smoking areas in restaurants are like peeing areas in swimming pools. **
-